package iotwisp.school.web.config;

import iotwisp.school.api.interceptor.LoginCheckInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        // 注册登录拦截器，添加拦截路径和排除拦截路径
        registry.addInterceptor(new LoginCheckInterceptor()).addPathPatterns("/api/**")
                .excludePathPatterns(
                        "/api/org/admin/login",
                        "/api/org/user/login",
                        "/api/org/user/register",
                        "/api/payment/alipay/notify",
                        "/api/system/sms/send",
                        "/api/system/config/query",
                        "/api/wx/**",
                        "/api/system/image/**",
                        "/api/product/**",
                        "/api/pc/user/login",
                		"/api/pc/file/upload_callback",
                		"/api/pc/file/check_callback",
                		"/api/app/user/login"
                		);
	}
}
